package com.lxw.study.structural.composite.case2;

/**
 * Leaf节点
 */
public class File implements FileSystemComponent {
    private final String name;

    public File(String name) {
        this.name = name;
    }

    @Override
    public void display() {
        System.out.println("File: " + name);
    }

    @Override
    public void addComponent(FileSystemComponent component) {
        throw new UnsupportedOperationException(this.name + "是文件,不支持添加");
    }
}
